package com.youpai.platform.user.service.service.impl;

import com.youpai.platform.user.service.biz.impl.UserActiveBizServiceImpl;
import com.youpai.platform.user.service.entity.dto.UserActiveDTO;
import com.youpai.platform.user.service.service.UserActiveService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @date: 2022/12/11
 * @author: Welles
 * @version: 1.0
 * @description: 用户在线状态服务
 */
@Slf4j
@Service
public class UserActiveServiceImpl implements UserActiveService {

    private UserActiveBizServiceImpl userActiveBizService;

    @Override
    public Map<Long, UserActiveDTO> userActiveQuery(List<String> uidList) {
        if (CollectionUtils.isEmpty(uidList)) {
            log.error("userActiveQuery 入参异常");
            return new HashMap<>();
        }
        List<Long> uidListLong = uidList.stream().mapToLong(Long::parseLong).boxed().collect(Collectors.toList());
        return userActiveBizService.queryUserActive(uidListLong);
    }
}
